﻿//  --------------------------------
//  Copyright (c) AW Systems, Inc. All rights reserved.
//  This source code is made available under the terms of the Microsoft Public License (Ms-PL)
//  http://www.codeplex.com/SLAM/license
//  ---------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace AWS.SLAM.Administration
{
    public static class InstallationValidator
    {
        public static bool VerifyNetFx35IsInstalled()
        {   
            bool framework35Installed = true;
            try
            {
                //An easy way to test for the 3.5 framework, without worrying about hitting the 
                //Registry, is to try to load one of the assemblies SLAM needs from the 3.5 framework. 
                //If it is not found AppDomain.Load will throw an exception.
                System.Reflection.Assembly assembly = AppDomain.CurrentDomain.Load("System.Data.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
                if (assembly == null)
                {
                    framework35Installed = false;
                }
            }
            catch
            {
                framework35Installed = false;
            }
            return framework35Installed;
        }
    }
}
